<template>
  <div class="type-menu ">
    <div v-for="(x, y) in list" :key="y" @click="selectType(y)" :class="idx == y ? 'active' : ''">
      <span> {{ x }} </span>
      <div v-if="idx == y"></div>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue';
const emit = defineEmits(['select'])
const props = defineProps({
  num:{
    type: Number,
    defalut: 0

  },
  list: {
    type: Array,
    defalut: []
  }
})
const idx = ref(0)
function selectType(y) {
  idx.value = y
  emit('select', y)
}
</script>
<style scoped lang="scss">

$bg: rgba(13, 13, 13, 0.5);
$bg2: #1f2529;
.type-menu {
  display: flex;
  height: 40px;
  margin: 10PX;

  >div {
    //width: 130px;
    height: 40px;
    margin-right: 20px;
    background-color: $bg;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    padding: 0 20px;

    >div {
      width: 100%;
      height: 2px;
      background-color: #1889fa;
      position: absolute;
      bottom: 0px;
    }
  }
}
</style>
